import time

from selenium.webdriver.common.by import By

from common.base import Base
from common.functions import open_browser


class DetailsGoodsPage(Base):
    def goods_name_details(self):  # 详情页商品名称
        return self.find_element_text((By.CLASS_NAME, 'goods_style_name'))

    def shopping_details(self):
        self.click((By.CLASS_NAME, 'td1'))  # 点击立即购买按钮

    def collect(self):
        self.click((By.CLASS_NAME, 'td2'))  # 点击收藏按钮

    def number(self, num):  # 输入商品数量
        self.num = num
        self.double_click((By.ID, 'number'))
        self.send_keys((By.ID, 'number'), self.num)
